Open
Conversation
victorbianchi
added a commit
to victorbianchi/ComputationalArt
that referenced
this pull request
Oct 2, 2017
victorbianchi
added a commit
to victorbianchi/ComputationalArt
that referenced
this pull request
Oct 2, 2017
| return x ** 2 | ||
| elif f[0] == "cube": | ||
| # print("return : ", f[1]**3 ) | ||
| return x ** 3 |
There was a problem hiding this comment.
Great job overall, but I think you can remove the commented print code when submitting
| if randomfunction in ["x","y"]: | ||
| list.append(randomfunction) | ||
| return list | ||
|
|
There was a problem hiding this comment.
For the two if statements from the bottom, I think you can make it as elif statement. That would make the code to jump right to the return if the randomfunction was 'avg' or 'prod'. (Just minor details)
Also, I think list is a reserved keyword for python language, so I would recommend not to use list as variable names. Sometimes you might see unexpected behaviors
| >>> evaluate_random_function(["sin_pi", ["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]]], 0, 0) | ||
| 0.0 | ||
| >>> evaluate_random_function(['sin_pi', ['cos_pi', ['cos_pi', ['x']]]], -1, -1) | ||
| 0.0 |
There was a problem hiding this comment.
I like how you added more unit tests! Great!
Author
|
Thanks for the feedback Tony!
For the future I will keep these critiques in mind when coding!
…On Wed, Oct 11, 2017 at 4:12 AM, Young Seok Tony Kim < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In recursive_art.py
<#2 (comment)>
:
> @@ -42,9 +63,48 @@ def evaluate_random_function(f, x, y):
-0.5
>>> evaluate_random_function(["y"],0.1,0.02)
0.02
+ >>> evaluate_random_function(["prod"],4,2)
+ 8
+ >>> evaluate_random_function(["prod", ["x"], ["y"]], 0, 0)
+ 0
+ >>> evaluate_random_function(["prod", ["avg", ["x"],["y"]], ["x"]], 2, 2)
+ 4
+ >>> evaluate_random_function(["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]], 0, 0)
+ 0.0
+ >>> evaluate_random_function(["sin_pi", ["avg", ["prod", ["avg", ["x"],["y"]], ["x"]], ["prod", ["x"], ["y"]]]], 0, 0)
+ 0.0
+ >>> evaluate_random_function(['sin_pi', ['cos_pi', ['cos_pi', ['x']]]], -1, -1)
+ 0.0
I like how you added more unit tests! Great!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AeO8pmuv-z8oTAdEHWSTy6nNkG5Lf2E_ks5srHiLgaJpZM4PpuzH>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.